package com.examplemartin.jpademo.dao;

import com.examplemartin.jpademo.pojo.po.MenuPO;
import org.mapstruct.Mapper;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface MenuDao extends JpaRepository<MenuPO, Long> {

    @Query("from t_menu t1 where t1.parent.id = :id ")
    List<MenuPO> findAllByParentMenuEquals(Long id);

    List<MenuPO> findMenuPOSByParent(MenuPO p);

//    List<MenuPO> findAllByParentOrderByPosition(Long id);


}
